Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue #104 :
What the fix does.
parseParameter now uses boundedPattern only as a guard: if a state file still contains the old BEAST2 format with explicit
bounds (e.g. kappa{[0.0,Infinity]}: 1.5), it throws IllegalArgumentException immediately with a clear message explaining
that bounds are now derived from the domain and values can be constrained further through a prior distribution. For all
valid BEAST3 state files, a single noboundPattern branch handles every parameter type — RealScalarParam, IntScalarParam,
RealVectorParam, IntVectorParam, BoolScalarParam, BoolVectorParam — dispatching on the runtime type of param rather than
guessing the type from the string format. The pattern was also made non-greedy (.*?) so the optional {shape} group is
captured correctly for vectors and not swallowed by the leading wildcard. In paramToString, the trailing ", " left over
from the removed BoundedParam call was dropped, so vectors now serialize as freqs{4}: ... and the shape survives the
round-trip.
Why the original code was structured this way.
The original design had two parallel formats: parameters with explicit bounds serialized as kappa{[0.0,Infinity]}: 1.5 and
boolean parameters without bounds serialized as isEstimated: true. The two if/else branches in parseParameter matched
each format and then dispatched to the right type, which was safe because the format uniquely identified the type in
BEAST2 — only booleans lacked bounds. When BoundedParam was removed in BEAST3, the bounds serialization code in
paramToString was commented out but the parsing logic in parseParameter was never updated. Real and integer parameters
then started producing bound-free strings identical in shape to boolean ones, while the parser still assumed bound-free
always meant boolean. The fix collapses the two branches into one: since the serialized string no longer carries enough
information to infer the type, the code simply trusts the type of the param object it was handed.